package com.dmtt.web.controller;

import com.dmtt.util.R;
import com.dmtt.web.entity.User;
import com.dmtt.web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/user/")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("login")
    public R login(@RequestBody User user, HttpServletRequest request){
        String message = userService.login(user,request);
        return R.ok().put("message",message);
    }

}
